﻿using Design.Common.Utils;

namespace SingletonPattern
{
    internal sealed class HungryManSngleton
    {
        private static readonly HungryManSngleton _instance = new();
        private const string _name = "饿汉模式";

        private HungryManSngleton()
        {
            ConsoleExpansion.WriteLine($"{_name} 创建实例:{Guid.NewGuid()}");
        }

        public static HungryManSngleton Instance
        {
            get
            {
                ConsoleExpansion.WriteLine($"{_name} 获取实例 is null {_instance == null}");
                return _instance;
            }
        }
    }
}